{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">
        <form action="{:url('admin/card/index')}" class="layui-form" method="get">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="text" name="number" value="{:input('number')}" autocomplete="off" placeholder="请输入卡号" class="layui-input"/>
                </div>
                <div class="layui-input-inline">
                    <select name="buystatus">
                        <option value="">是否导出</option>
                        <option value="1" {if condition="input('?buystatus') and (input('status') eq 1)"} selected="selected"{/if}>是</option>
                        <option value="0" {if condition="input('?buystatus') and (input('status') eq 0)"} selected="selected"{/if}>否</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="usestatus">
                        <option value="">是否使用</option>
                        <option value="1" {if condition="input('?usestatus') and (input('status') eq 1)"} selected="selected"{/if}>是</option>
                        <option value="0" {if condition="input('?usestatus') and (input('status') eq 0)"} selected="selected"{/if}>否</option>
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="">状态</option>
                        <option value="1" {if condition="input('?status') and (input('status') eq 1)"} selected="selected"{/if}>正常</option>
                        <option value="0" {if condition="input('?status') and (input('status') eq 0)"} selected="selected"{/if}>禁用</option>
                    </select>
                </div>
                <div>
                    <button class="layui-btn layui-btn-primary ajax-search"><i class="fa fa-search"></i></button>
                </div>
            </div>
        </form>
    </div>
    <div class="layui-card-body">
        <div class="layui-btn-group">
            <a href="{:url('admin/card/add')}" class="layui-btn ajax-iframe" data-width="600px" data-height="400px"><i class="fa fa-plus-circle"></i> 生成充值卡</a>
            <a href="{:url('admin/card/del')}" class="layui-btn layui-btn-danger ajax-batch"><i class="fa fa-trash-o"></i> 批量删除</a>
            <a href="{:url('admin/card/edit',['name' => 'status', 'value' => '1'])}" class="layui-btn layui-btn-primary ajax-batch"><i class="fa fa-ban"></i> 设为禁用</a>
            <a href="{:url('admin/card/edit',['name' => 'status', 'value' => '0'])}" class="layui-btn layui-btn-primary ajax-batch"><i class="fa fa-bullseye"></i> 取消禁用</a>
            <a href="{:url('admin/card/edit',['name' => 'buystatus', 'value' => '1'])}" class="layui-btn layui-btn-primary ajax-batch"><i class="fa fa-flag-o"></i> 标记导出</a>
            <a href="{:url('admin/card/edit',['name' => 'buystatus', 'value' => '0'])}" class="layui-btn layui-btn-primary ajax-batch"><i class="fa fa-close"></i> 取消导出</a>
            <a href="{:url('admin/card/export')}" class="layui-btn layui-btn-primary ajax-iframe" data-width="600px" data-height="400px"><i class="fa fa-file-excel-o"></i> 导出点卡</a>
        </div>
        <table class="layui-table layui-form">
            <thead>
            <tr>
                <th style="width:20px;"><input type="checkbox" lay-skin="primary" lay-filter="*"></th>
                <th style="width:20px;">ID</th>
                <th >卡号</th>
                <th  style="width:80px;">面值</th>
                <th  style="width:80px;">是否导出</th>
                <th  style="width:80px;">是否使用</th>
                <th  style="width:120px;">使用者</th>
                <th  style="width:80px;">状态</th>
                <th  style="width:50px;">操作</th>
            </tr>
            </thead>
            <tbody>
            {foreach name="list" item="v" empty="$empty"}
            <tr>
                <td><input type="checkbox" name="id" value="{$v.id}" lay-skin="primary"></td>
                <td>{$v.id}</td>
                <td>{$v.number}</td>
                <td>{$v.money}元</td>
                <td>{if condition="$v.buystatus==0"}未导出{/if} {if condition="$v.buystatus==1"}已导出{/if}</td>
                <td>{if condition="$v.usestatus==0"}未使用{/if} {if condition="$v.usestatus==1"}已使用{/if}</td>
                <td>{$v.uid|getUserName}</td>
                <td> {if condition="$v.status==0"}正常{/if} {if condition="$v.status==1"}<font color="red">禁用</font>{/if}</td>
                <td><a href="{:url('admin/card/del', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-danger ajax-delete"> <i class="layui-icon">&#xe640;</i></a></td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        <div class="page">{$list->render()}</div>
    </div>
</div>
{/block}